package com.pocket.cloud.common.client;

import com.pocket.cloud.common.api.ResultData;
import com.pocket.cloud.common.api.ReturnCodeEnum;
import com.pocket.cloud.common.dto.OrderSettlementDTO;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * 【cloud-FeignClient-sentinel-2】
 * @author zhaozhile
 */
public class PaymentClientFallBackFactory implements FallbackFactory<PaymentClient> {
    @Override
    public PaymentClient create(Throwable cause) {
        return new PaymentClient() {
            @Override
            public ResultData<OrderSettlementDTO> getPayByOrderNo(String orderNo) {
                return ResultData.fail(ReturnCodeEnum.RC500, "上游服务异常，触发Payment服务FallBack降级!");
            }
        };
    }
}
